/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "flash.h"
#include "ospi_w25q64.h"
#include "bsp.h"
#include "modbus.h"
#include "string.h"
#include "ds1302.h"
#include <stdint.h>
/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */
void delay_us(uint32_t nus);
void usb_printf(const char *format, ...);
/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define Power_ADC_Pin GPIO_PIN_2
#define Power_ADC_GPIO_Port GPIOC
#define VBAT_Pin GPIO_PIN_3
#define VBAT_GPIO_Port GPIOC
#define JDQ1_Pin GPIO_PIN_4
#define JDQ1_GPIO_Port GPIOA
#define JDQ2_Pin GPIO_PIN_5
#define JDQ2_GPIO_Port GPIOA
#define UART7_TX_Pin GPIO_PIN_7
#define UART7_TX_GPIO_Port GPIOE
#define UART7_RX_Pin GPIO_PIN_8
#define UART7_RX_GPIO_Port GPIOE
#define SYS_RUN_Pin GPIO_PIN_14
#define SYS_RUN_GPIO_Port GPIOE
#define CE_Pin GPIO_PIN_9
#define CE_GPIO_Port GPIOD
#define ds1302_io_Pin GPIO_PIN_10
#define ds1302_io_GPIO_Port GPIOD
#define SCLK_Pin GPIO_PIN_11
#define SCLK_GPIO_Port GPIOD
#define USART6_RE_Pin GPIO_PIN_8
#define USART6_RE_GPIO_Port GPIOA
#define UART5_RE_Pin GPIO_PIN_9
#define UART5_RE_GPIO_Port GPIOA
#define SDMMC1_CD_Pin GPIO_PIN_0
#define SDMMC1_CD_GPIO_Port GPIOD
#define USART1_RE_Pin GPIO_PIN_3
#define USART1_RE_GPIO_Port GPIOB
#define USART3_RE_Pin GPIO_PIN_4
#define USART3_RE_GPIO_Port GPIOB
#define USART2_RE_Pin GPIO_PIN_5
#define USART2_RE_GPIO_Port GPIOB
#define UART4_RE_Pin GPIO_PIN_6
#define UART4_RE_GPIO_Port GPIOB

/* USER CODE BEGIN Private defines */
#define TIM_HANDLE &htim3
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
